<template>
	<view >
		<view class="con">
			<back :title="type==0?'将指定材料合成稀有藏品':type==2?'分解活动':''"></back>
		</view>
		
		<view class="posire" >
			<view class="height100 posifi top0  width92vw zindex6 flex-a-i" :style="{paddingTop:shh+'px'}">
				<view @click="back" class=" posiab zindex1   left30">
					<image mode="widthFix" class="image width32   " :src="theme?'/static/back.png':'/static/hback.png'"></image>
				</view>
			</view>

				<!-- <view class="flex-ju-c " >
					<image mode="widthFix" v-if="type==2" class="image width162" :src="theme?'/static/img/tfenjietitle.png':'/static/img/fenjietitle.png'">
					</image>
					<image mode="widthFix" v-else-if="type==1" class="image width162"
						src="/static/img/zhihuantitle.png">
					</image>
					<image mode="widthFix" v-else class="image width162" :src="theme?'/static/img/thechengtitle.png':'/static/img/hechengtitle.png'"></image>
				</view> -->
				<view v-if="isdata" class="flex-ju-c mt8vh">
					<view class="flex-ju-c flex-col">
						<image mode="widthFix" class="width210 ra20" src="/static/nodata.png"></image>
						<view class=" size24">这里什么也没有~</view>
					</view>
				</view>
				<view class="flex-ju-b flex-wrap pb30 con ">
					<view @click="navto('detail?type='+type+'&uuid='+item.uuid+'&stype='+stype)" v-for="(item,p) in list" :key="p"
						class=" mb30 ra20 borderE1E1E1" :class="theme?'bg292929 colorfff':'bgfff'">
						<view class="posire">
							<image class="image wh333-333 ra20" :src="item.thumb"></image>
						</view>
						<view class="width300" style="margin: auto;">
							<view class=" one bold size29  mt10">{{item.title}}</view>
							<view class="  size24 mt5">剩余{{item.stock}}次</view>
							<view class="size20 color999  mt10">{{item.start_date}} 开始</view>
							<view class="size20 color999  mt5 mb25">{{item.end_date}} 结束</view>
							<view class="pb25">
								<view v-if="!item.endtimer" class="flex-ju-b">
									<image  mode="widthFix" class="image width80  "
										src="/static/yijieshu.png"></image>
										<image  mode="widthFix" class="image width27  "
											src="/static/yijieshus.png"></image>
								</view>
								
								<template v-else>
									<view v-if="item.starttimer" class="flex-ju-b">
										<image  mode="widthFix" class="image width80  "
											src="/static/weikaifang.png"></image>
											<image  mode="widthFix" class="image width43  "
												src="/static/weikaifangs.png"></image>
									</view>
									
									<template v-else>
										<view v-if="item.is_stock <= 0" class="flex-ju-b">
											<image  mode="widthFix"
												class="image width80  " src="/static/yijieshu.png">
											</image>
											<image  mode="widthFix" class="image width27  "
												src="/static/yijieshus.png"></image>
										</view>
											<view v-else  class="flex-ju-b">
												<image  mode="widthFix" class="image width80  "
													src="/static/kaifangzhong.png"></image>
													
													<image  mode="widthFix" class="image width43  "
														src="/static/kaifangzhongs.png"></image>
											</view>
										
									</template>
								</template>
							</view>
						</view>
					</view>
				</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: 0,
				list: [],
				isdata: false,
				stype:"",
				theme: uni.getStorageSync('theme')
			}
		},
	
		onLoad(option) {
			this.type = option.type
			this.stype = option.stype
			
		},
		onShow() {
			if (this.type == 2) {
				this.http('decompose/index').then(res => {
					this.getlist(res)
				})
			} else if (this.type == 0) {
				if(this.stype == 3){
					this.http('bfcombination',{
					}).then(res => {
						this.getlist(res)
					})
				}else{
					this.http('combination',{
						type:this.stype
					}).then(res => {
						this.getlist(res)
					})
				}
				
			}else{
				this.http('exchange/index').then(res => {
					this.getlist(res)
				})
			}
		},
		methods: {
			getlist(res) {
				res.data.map((item) => {
					item.endtimer = this.istime(item.end_date);
					item.starttimer = this.istime(item.start_date);
				});
				this.list = res.data
				if (res.data.length) {
					this.isdata = false
				} else {
					this.isdata = true
				}
			}
		}
	}
</script>

<style>
	page {
		background: #f5f6f7;
	}


</style>